package com.baizhiedu.dynamic;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * 功能：
 * 作者：HZj
 * 日期：2024/12/23 22:07
 */
public class Arround1 implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
//        System.out.println("额外功能 log--------");
//        Object ret = methodInvocation.proceed();
//        return ret;
        //抛出异常
        Object ret = null;
        try {
            ret = methodInvocation.proceed();
        } catch (Throwable throwable) {
            System.out.println("-----原始方法异常抛出 执行额外的功能------");
            throwable.printStackTrace();
        }
        return ret;
    }
}
